<template>
	<!-- 动态详情 -->
	<view class="web">
		<view class="web_t">
			<view class="nav">
				<uni-nav-bar class="header" :border="false" dark color="#000" backgroundColor="#fff" left-icon="left"
					leftWidth="200rpx" rightWidth="200rpx" title="动态详情" />
			</view>
			<!-- 头 -->
			<view class="text_title">
				<h1>{{news.title}}</h1>
				<span style="color: #455682;">{{news.typename}}</span>
				<span style="color: grey;">{{news.addtime}}</span>
			</view>
			<view class="text_content">
				<rich-text :nodes="news.content"></rich-text>
			</view>
		</view>
		<view class="web_b">
			<view class="read_text">
				阅读931
			</view>
			<view class="read_ico">
				<i class="iconfont icon-dianzan">0</i>
				<i class="iconfont icon-zhuanfa">转发给朋友</i>
				<i class="iconfont icon-pengyouquan">转到朋友圈</i>
			</view>
		</view>
	</view>

</template>

<script>
	import {getNews} from '../../api/news.js'
	export default {
		data() {
			return {
				news:{id:0}
			}
		},
		onLoad(opttion) {
			this.news.id=opttion.id;
			this.getNewsModel();
		},
		methods: {
			async getNewsModel(){
				const {errCode,data}=await getNews(this.news.id);
				if(errCode===10000){
					this.news=data;
					
					console.log(this.news.content);
					
					 this.news.content=this.news.content ? this.news.content.replace(/<img /g,'<img style="max-width:100%;height:auto" ') : "";
					//this.news.content=
				}
			}
		}
	}
</script>

<style>
@import url('../../static/css/dynamic.css');
</style>
